
package Base;

import java.awt.Image;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.swing.ImageIcon;

/**
 *
 * @author Rosana
 */
public class ConvertByte {
    
    public static byte[] imageToByte(String image) throws IOException {
        InputStream is;
        byte[] buffer;
        is = new FileInputStream(image);
        buffer = new byte[is.available()];
        is.read(buffer);
        is.close();
        return buffer;
    }
    
    public static Image ConvertByteArrayToImage(byte[] image)
    {
        Image imgFoto = new ImageIcon(image).getImage();
        return imgFoto;
    }
}